from flask import Flask
# from flask_bcrypt import Bcrypt
from .config import load_config
from .model._base import db
from .view import main, user, todo
from .until import login_manager


# bcrypt = Bcrypt()
# , static_folder="static"
def create_app():
    app = Flask(__name__, template_folder="templates")
    app.config.from_object(load_config())
    # 插件初始化
    # bcrypt.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)
    # 注册蓝图
    app.register_blueprint(main.bp, url_prefix='/')  # 主页
    app.register_blueprint(user.bp, url_prefix='/user')  # 用户
    app.register_blueprint(todo.bp, url_prefix='/todo')  # 文件
    return app
